# 名称:Backdream
# 时间2022/12/27 11:39
# 新搜索框页面类


from appium.webdriver.common.mobileby import MobileBy as By
from pages.base_page import BasePage

class SearchNewPage(BasePage):
    """新的搜索界面页面类"""

    #定位器
    search_new_locator = (By.XPATH, "//android.widget.EditText[@resource-id=\"searchInp\"]")
    cancel_locator = (By.XPATH, "//android.view.View[@text=\"取消\"]")
    search_result_locator = (By.XPATH, "//android.view.View[@text=\"【风车叶兑换】日日煮新版帆布袋\"]")
    cancel_result_locator = (By.XPATH, "//android.widget.TextView[@text=\"大家都在搜“日日煮星厨菜肴”\"]")

    def search_new_input(self, search_text):
        self.find_element(self.search_new_locator).sendkeys(search_text)

    def cancel_click(self):
        self.find_element(self.cancel_locator).click()

    def get_search_result(self):
        return self.find_element(self.search_result_locator).text

    def get_cancel_result(self):
        return self.find_element(self.cancel_result_locator).text




